package a66weding.com.jiehuntong.activity;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Toast;

import a66weding.com.jiehuntong.R;
import a66weding.com.jiehuntong.anim.FABRevealLayout;
import a66weding.com.jiehuntong.anim.OnRevealChangeListener;

/**
 * Created by admin on 2016/6/21.
 */
public class Main extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_diy_home_b);
        FABRevealLayout fabRevealLayout = (FABRevealLayout) findViewById(R.id.fab_reveal_layout);
        configureFABReveal(fabRevealLayout);
    }

    private void configureFABReveal(FABRevealLayout fabRevealLayout) {
        fabRevealLayout.setOnRevealChangeListener(new OnRevealChangeListener() {
            @Override
            public void onMainViewAppeared(FABRevealLayout fabRevealLayout, View mainView) {
            }

            @Override
            public void onSecondaryViewAppeared(final FABRevealLayout fabRevealLayout, View secondaryView) {
                Toast.makeText(Main.this, "ddd", Toast.LENGTH_LONG).show();
                prepareBackTransition(fabRevealLayout);
            }
        });
    }

    /**
     * 返回动画-------------------------------------
     *
     * @param fabRevealLayout
     */
    private void prepareBackTransition(final FABRevealLayout fabRevealLayout) {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                fabRevealLayout.revealMainView();
            }
        }, 3000);
    }
}
